<%@ page pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<link href="${ctx}/css/main.css" rel="stylesheet" type="text/css" />
	</head>
	<script language="javascript">
		function submitAction(actionName){
			document.typeForm.action = actionName ;
			document.typeForm.submit();
		}
		
		function init(){
			document.getElementById("typeCode").value = "";
			document.getElementById("typeName").value = "";
		}
		
		function select(action,id){
			location.href = "${ctx}/" + action + "?id=" + id;
		}
		
		function doDelete(action,id){
			if(confirm('删除时该类别下的所有子类别将被删除，是否确认删除？')){
				location.href = "${ctx}/" + action + "?id=" + id ;
			}
		}
	</script>
	
	<body>
		<form method="post" action="" name="typeForm">
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td2"> 
						类别代码 
					</td>
					<td width="30%" class="td2">
						<input type="text" name="typeCode" size="32" value="${typeCode.typeCode}">
					</td>
					<td width="20%" class="td2">
						类别名称
					</td>
					<td width="30%" class="td2">
						<input type="text" name="typeName" size="32" value="${typeCode.typeName}">
					</td>
				</tr>
				<tr>
					<td class="td11" align="left" colspan="4">
						<input type="button" name="search" value="查询" onClick="submitAction('typeCodeSearch.ac');">
						&nbsp;&nbsp;<input type="button" name="new" value="新增" onClick="submitAction('newTypeCode.ac');">
						&nbsp;&nbsp;<input type="button" name="reset" value="重置" onClick="init()">
					</td>
				</tr>
			</table>
			<BR>
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="13%" class="td1" align="center">
						动作
					</td>
					<td width="21%" class="td1" align="center">
						类别代码
					</td>
					<td width="25%" class="td1" align="center">
						类别名称
					</td>
					<td width="15%" class="td1" align="center">
						样式
					</td>
					<td width="13%" class="td1" align="center">
						层次
					</td>
					<td width="13%" class="td1" align="center">
						删除
					</td>
				</tr>
				<c:forEach var="typeCode" items="${typeCodeList}">
					<tr>
						<td class="td2" align="center">
							<a href="javascript:select('selectTypeCode.ac','${typeCode.id}');">选择</a>
						</td>
						<td class="td2">
							${typeCode.typeCode}
						</td>
						<td class="td2">
							${typeCode.typeName}
						</td>
						<td class="td2">
							${typeCode.style}
						</td>
						<td class="td2" align="center">
							<c:if test="${typeCode.levels == 1}">一级</c:if>
							<c:if test="${typeCode.levels == 2}">二级</c:if>
							<c:if test="${typeCode.levels == 3}">三级</c:if>
						</td>
						<td class="td2" align="center">
							<img src="${ctx}/images/delete0.png" onclick="javascript:doDelete('deleteTypeCode.ac','${typeCode.id}');">
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</body>
</html>